<?php
@@ini_set('session.bug_compat_warn', 0);
@@ini_set('session.bug_compat_42', 0);
session_start() ;
if(!isset($_SESSION["login"]) || $_SESSION["login"] == "")
{   
  header("Location: index.php?error=4") ;
}?>

<html>
<head>
<title>Administration</title>
 <link rel="stylesheet" type="text/css" href="style.css" >  
</head>

<body>
<?php require("menu.php");
require("fonctions.php");
$code=$_GET["error"];
$codesap =  $_POST["codesap"];
$nom_dis =  $_POST["nom_dis"];
$manager =  $_POST["manager"];
$reseau =  $_POST["reseau"];
$zones =  $_POST["zones"];
$groupe =  $_POST["groupe"];
?>
<p class="titre">Gestion des &eacute;tablissements</p>
<br></br>
<?php echo error_message($code);?>
<br>
<form action="controler.php?action=aff_man" method="post"id="chg_enq" name="chg_f">
<fieldset>
<legend>Affectation de manager aux distributeurs</legend>
<table>
<tr>
	
		<td>MANAGER</td>
	<td>	<select name="manager" >
	<option value="0"></option>
	<?php $sql3="select * from managers group by nom";
	$res3=mysql_query($sql3);
	while($r3=mysql_fetch_object($res3)){
		?>
	<option value="<?php echo $r3->id;?>" <?php if($r3->id=="$manager") echo "selected";?>><?php echo "$r3->nom"; echo " $r3->prenom";?></option>
	<?php }?>
	</select>
	</td>

	</tr>
	<tr>

<td></td>
	<td>ETABLISSEMENT 1
			<select name="nom_dis1" >
			<option value="0"></option>
	<?php $sql2="select id,nom from distributeurs order by nom";
	$res2=mysql_query($sql2);
	while($r2=mysql_fetch_object($res2)){
	?>
	<option value="<?php echo $r2->id;?>" <?php if($r2->id=="$nom_dis") echo "selected";?>><?php echo $r2->nom;?></option>
	<?php }?>
	</select>
	</td>
	</tr>
	<tr>
<td></td>
	<td>ETABLISSEMENT 2
			<select name="nom_dis2" >
			<option value="0"></option>
	<?php $sql2="select id,nom from distributeurs order by nom";
	$res2=mysql_query($sql2);
	while($r2=mysql_fetch_object($res2)){
	?>
	<option value="<?php echo $r2->id;?>" <?php if($r2->id=="$nom_dis") echo "selected";?>><?php echo $r2->nom;?></option>
	<?php }?>
	</select>
	</td>
	</tr>
	<tr>
<td></td>
	<td>ETABLISSEMENT 3
			<select name="nom_dis3" >
			<option value="0"></option>
	<?php $sql2="select id,nom from distributeurs order by nom";
	$res2=mysql_query($sql2);
	while($r2=mysql_fetch_object($res2)){
	?>
	<option value="<?php echo $r2->id;?>" <?php if($r2->id=="$nom_dis") echo "selected";?>><?php echo $r2->nom;?></option>
	<?php }?>
	</select>
	</td>
	</tr>
	
		<tr>
<td></td>
	<td>ETABLISSEMENT 4
			<select name="nom_dis4" >
			<option value="0"></option>
	<?php $sql2="select id,nom from distributeurs order by nom";
	$res2=mysql_query($sql2);
	while($r2=mysql_fetch_object($res2)){
	?>
	<option value="<?php echo $r2->id;?>" <?php if($r2->id=="$nom_dis") echo "selected";?>><?php echo $r2->nom;?></option>
	<?php }?>
	</select>
	</td>
	</tr>
<tr>
<td></td>
	<td>ETABLISSEMENT 5
			<select name="nom_dis5" >
			<option value="0"></option>
	<?php $sql2="select id,nom from distributeurs order by nom";
	$res2=mysql_query($sql2);
	while($r2=mysql_fetch_object($res2)){
	?>
	<option value="<?php echo $r2->id;?>" <?php if($r2->id=="$nom_dis") echo "selected";?>><?php echo $r2->nom;?></option>
	<?php }?>
	</select>
	</td>
	</tr>	
	
<tr>
</tr>	
<tr>
<td></td>
	<td>ETABLISSEMENT 6
			<select name="nom_dis6" >
			<option value="0"></option>
	<?php $sql2="select id,nom from distributeurs order by nom";
	$res2=mysql_query($sql2);
	while($r2=mysql_fetch_object($res2)){
	?>
	<option value="<?php echo $r2->id;?>" <?php if($r2->id=="$nom_dis") echo "selected";?>><?php echo $r2->nom;?></option>
	<?php }?>
	</select>
	</td>
	</tr>
	<tr>
<td></td>
	<td>ETABLISSEMENT 7
			<select name="nom_dis7" >
			<option value="0"></option>
	<?php $sql2="select id,nom from distributeurs order by nom";
	$res2=mysql_query($sql2);
	while($r2=mysql_fetch_object($res2)){
	?>
	<option value="<?php echo $r2->id;?>" <?php if($r2->id=="$nom_dis") echo "selected";?>><?php echo $r2->nom;?></option>
	<?php }?>
	</select>
	</td>
	</tr>
	<tr>
<td></td>
	<td>ETABLISSEMENT 8
			<select name="nom_dis8" >
			<option value="0"></option>
	<?php $sql2="select id,nom from distributeurs order by nom";
	$res2=mysql_query($sql2);
	while($r2=mysql_fetch_object($res2)){
	?>
	<option value="<?php echo $r2->id;?>" <?php if($r2->id=="$nom_dis") echo "selected";?>><?php echo $r2->nom;?></option>
	<?php }?>
	</select>
	</td>
	</tr>
	<tr>
<td></td>
	<td>ETABLISSEMENT 9
			<select name="nom_dis9" >
			<option value="0"></option>
	<?php $sql2="select id,nom from distributeurs order by nom";
	$res2=mysql_query($sql2);
	while($r2=mysql_fetch_object($res2)){
	?>
	<option value="<?php echo $r2->id;?>" <?php if($r2->id=="$nom_dis") echo "selected";?>><?php echo $r2->nom;?></option>
	<?php }?>
	</select>
	</td>
	</tr>
	<tr>
<td></td>
	<td>ETABLISSEMENT 10
			<select name="nom_dis10" >
			<option value="0"></option>
	<?php $sql2="select id,nom from distributeurs order by nom";
	$res2=mysql_query($sql2);
	while($r2=mysql_fetch_object($res2)){
	?>
	<option value="<?php echo $r2->id;?>" <?php if($r2->id=="$nom_dis") echo "selected";?>><?php echo $r2->nom;?></option>
	<?php }?>
	</select>
	</td>
	</tr>
<td>&nbsp;</td>
</tr>
<tr>
	<td colspan=2><input type="submit" value="Affecter"></td>
</tr>
</table>
</fieldset>

<br>


</form>
</body>

</html>
